<template>
  <div class="hh-login">
    <div class="hed" style="width: 1200px;display: flex;height:80px;align-items: center; margin: 40px auto;justify-content: space-between">
      <a href="/">
        <img data-v-48913c34="" src="~/assets/img/logo.png" width="286px" height="62px">
      </a>
      <p style="font-size: 20px;color: #1972ea"><span style="display: inline-block;background: url(/img/pziq.png) no-repeat;width: 26px;height: 26px;margin-right: 12px;position: relative;top: 5px"></span>400-855-1888</p>
    </div>
    <div class="ct">
      <div class="loginbox af">
        <div class="left">
          <h3 style="padding:0 20px">企业邦--企业经营资质服务平台</h3>
        </div>
        <div class="right">
          <h3>账号密码登录</h3>
          <p class="p1"><input type="text" id="username" placeholder="请输入账号" v-model ='name'></p>
          <p class="p2"><input type="password" id="password" placeholder="请输入密码" v-model ='password' @keyup.enter="login"></p>
          <div class="yz af">
            <!--<p class="p3"><input type="text" id="yzcord" placeholder="输入验证码" v-model = 'yz'></p>-->
            <!--<span></span>-->
            <a href="javascript:;" class="login" @click="login">马上登录</a>
          </div>

        </div>
      </div>
      <div class="db">
        <div class="tb">
          <a href="/">首页</a>
          <a href="/About">关于企业邦</a>
          <a href="javascript:;">诚聘英才</a>
          <a href="javascript:;">用户协议</a>
        </div>
        <span class="ban">版权所有：企业邦（北京）创业服务有限公司   <a href="https://beian.miit.gov.cn" style="color: #999">京ICP备17015986号-1</a></span>
      </div>
    </div>
    <div class="tc">
      <span>×</span>
      {{tcmsg}}
    </div>
    <!--<Header></Header>-->
  </div>
</template>

<script>
  import axios from 'axios';
  import $ from 'jquery';
  // import layui from 'layui-src';
  export default {
    props: ['foobar'],
    data () {
      return {
        yzm:null,
        name:'',
        password:'',
        yz:'',
        tcmsg:'我是一个弹窗'
      }
    },
    head () {
      return {
        title: '登录-企业邦',
        meta: [
          { hid: 'description', name: 'description', content:'登录-企业邦'},
          { hid: 'keywords', name: 'keywords', content:'登录-企业邦'}
        ]
      }
    },
    mounted:function(){
      $('.tc').click(function(){
        $(this).removeClass('select');
      });
      $(document).ready(function () {
          $('.htcfw').hide();
      });
      function setCookie(cname,cvalue,exdays)
      {
        var d = new Date();
        d.setTime(d.getTime()+(exdays*24*60*60*1000));
        var expires = "expires="+d.toGMTString();
        document.cookie = cname + "=" + cvalue + "; " + expires;
      }
    },
    methods:{
      login:function(){
        // layer.msg('放水阀发');
        if(this.name == ''||this.password == ''){
          this.tcmsg = '信息填写不完整';
          $('.tc').addClass('select');
          $('.tc').fadeIn(300);
          $('.tc').fadeOut(3000);
        }else{
          var _this = this;
          var s1 = this.password.split('');
          var s2 = s1[0];
          s1[0] = s1[1];
          s1[1] = s2;
          s1 = s1.join('');
          let lj = 'userinfoaccount='+this.name+'&userinfopassword='+s1;
          _this.$axios.post('/api'+'/PInterface/Login/signIn',lj)
            .then(function(response){
              _this.tcmsg = response.data;
              if(response.data == 'success'){
                _this.tcmsg = '登录成功';
                $('.tc').addClass('select');
                $('.tc').fadeIn(300);
                $('.tc').fadeOut(3000);
                window.open('/cPersonalCenter?idx=0','_self');
              } else if(response.data == 'telphone_is_null'){
                $('.tc').addClass('select');

              } else{
                $('.tc').addClass('select');
                $('.tc').fadeIn(300);
                $('.tc').fadeOut(3000);

              }
            });


        }

      }

    }
  }
</script>

<style>

</style>
